const path = require('path')
const webpack = require('webpack')
const HtmlWebPackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const htmlPlugin = new HtmlWebPackPlugin({
    template:path.join(__dirname,'./src/index.html'),
    filename:'index.html',
    favicon:'src/favicon.ico'
})
module.exports = {
    mode:'development',
    plugins:[
        htmlPlugin,
        new VueLoaderPlugin(),
        new webpack.ProvidePlugin({
            $: "jquery",
            jQuery: "jquery",
            jquery:"jquery",
            "window.jQuery":"jquery"
        })
    ],
    module:{
        rules:[
            {test:/\.js|jsx$/,use:'babel-loader',exclude:/node_modules/},
            {test:/\.css$/,use:['style-loader','css-loader']},
            {test:/\.less$/,use:['style-loader','css-loader','less-loader']},
            {test:/\.ttf|woff|woff2|eot|svg$/,use:'url-loader'},
            {test:/\.scss$/,use:['style-loader','css-loader','sass-loader']},
            {test:/\.jpg|png|gif|bmp|jpeg$/,use:'url-loader?name=[hash:8]-[name].[ext]'},
            {test:/\.vue$/,use:'vue-loader'}    
        ]
    },
    resolve:{
        extensions:['.js','.jsx','.json'],
        alias:{
            '@':path.join(__dirname,'./src'),
           // 'vue$':'vue/dist/vue.js'
        }
    },
    target:'web'
}